Skip to content

fix(sweep,sync): correct optuna install hint + drop false "0 records" warning - #142

Merged
asaiacai merged 1 commit into
mainfrom
fix/sweep-hint-and-drain-warning
Aug 13, 2026
Merged

fix(sweep,sync): correct optuna install hint + drop false "0 records" warning#142
asaiacai merged 1 commit into
mainfrom
fix/sweep-hint-and-drain-warning

Conversation

@ryanhayame

@ryanhayame ryanhayame commented Aug 13, 2026

Copy link
Copy Markdown

Two small SDK bugs surfaced in a docs audit of #131. Both are low-risk and don't change how a normal run uploads during a run.

1. Wrong package name in the optuna install hint (pluto/sweep.py)

A missing-optuna bayes sweep raised a hint saying pip install pluto[sweep]. But the distribution is pluto-ml, and pluto is a real, unrelated package on PyPI — so following the hint silently installs someone else's package (with an unknown [sweep] extra) instead of failing loudly, leaving the user with a foreign package and still no optuna. Fixed to pip install "pluto-ml[sweep]".

2. Contradictory "0 records may not have been uploaded" warning (pluto/op.py)

On a large run, finish()'s wait can time out (sync_completed=False), after which stop()'s SIGTERM drain empties the queue. op.py then read the pending count after that drain — so it literally printed 0 records may not have been uploaded, a data-loss-looking message at the exact moment nothing was lost. Now it only warns when pending > 0.

Tests

  • test_bayes_missing_optuna_names_the_real_package — the hint names pluto-ml[sweep], not pluto[sweep].
  • TestFinishDrainWarning — no warning when the drain emptied the queue; still warns when records genuinely remain.

Not included (deferred)

This does not touch the underlying ~30s finish stall (a throttle-vs-shutdown mismatch that predates #131, from #27). That's a separate, more involved change that mostly affects bulk migration of large runs and warrants its own concurrency/load testing.

🤖 Generated with Claude Code


Note

Low Risk
Logging and error-message fixes only; no change to upload behavior during normal runs or sweep optimization logic.

Overview
Fixes two small SDK messaging bugs from a docs audit.

Bayes sweep install hint (pluto/sweep.py): When optuna is missing, the ImportError now tells users to install "pluto-ml[sweep]" instead of pluto[sweep]. The old name pointed at a different PyPI package, so following it could install the wrong project and still leave optuna missing.

Finish / sync shutdown (pluto/op.py): If sync shutdown times out but the SIGTERM drain already emptied the queue, finish() no longer logs that records may not have been uploaded when get_pending_count() is 0. The warning still appears when pending records remain.

Tests cover the optuna message and both drain-warning cases (TestFinishDrainWarning, test_bayes_missing_optuna_names_the_real_package).

Reviewed by Cursor Bugbot for commit a2aee2d. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Sync shutdowns no longer show timeout warnings when all records are successfully sent.
    • Missing sweep support now displays the correct installation guidance.
  • Tests

    • Added coverage for accurate pending-record warnings during shutdown.
    • Added regression coverage for the corrected sweep installation message.

… warning

Two small SDK bugs found in a docs audit of #131:

- sweep: the bayes-needs-optuna hint said `pip install pluto[sweep]`, but the
  distribution is `pluto-ml` and `pluto` is an unrelated package on PyPI — so
  following the hint silently installs someone else's package (with an unknown
  extra) instead of failing. Corrected to `pip install "pluto-ml[sweep]"`.
- op: finish() warned "{pending} records may not have been uploaded" using a
  count read AFTER stop()'s SIGTERM drain had already emptied the queue, so it
  printed "0 records may not have been uploaded" — a data-loss-looking message
  at the moment nothing was lost. Only warn when pending > 0.

Tests: bayes-missing-optuna message names pluto-ml (not pluto); finish() doesn't
warn when the drain emptied the queue but does when records genuinely remain.

Note: does NOT touch the ~30s finish stall (throttle-vs-shutdown mismatch) — a
separate, more involved change, deferred.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2033e5ed-acc0-4701-a5af-e40efc625ea4

📥 Commits

Reviewing files that changed from the base of the PR and between e014ee4 and a2aee2d.

📒 Files selected for processing (4)
  • pluto/op.py
  • pluto/sweep.py
  • tests/test_run_status.py
  • tests/test_sweep.py

📝 Walkthrough

Walkthrough

The shutdown path now suppresses warnings when no records remain pending. The Bayesian sweep error now recommends the pluto-ml[sweep] extra. Tests cover both behaviors.

Changes

Behavior Corrections

Layer / File(s) Summary
Pending-record shutdown warning
pluto/op.py, tests/test_run_status.py
The shutdown path warns only when records remain unsent. Tests cover both empty and pending queues.
Bayesian sweep installation hint
pluto/sweep.py, tests/test_sweep.py
The missing-Optuna message now references pluto-ml[sweep]. The regression test rejects the old package hint.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to a2aee

The PR corrects an installation hint and removes a misleading warning, with no actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: asaiacai

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both fixes: the Optuna installation hint and the false zero-record warning.
Description check ✅ Passed The description explains both changes, test coverage, risk, and the deferred finish stall; the required information is mostly complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sweep-hint-and-drain-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@asaiacai asaiacai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@asaiacai
asaiacai merged commit 14285ad into main Aug 13, 2026
18 checks passed
@asaiacai
asaiacai deleted the fix/sweep-hint-and-drain-warning branch August 13, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants